package a66weding.com.jiehuntong.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;

import com.andview.refreshview.XRefreshView;
import com.andview.refreshview.XRefreshViewFooter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import a66weding.com.jiehuntong.R;
import a66weding.com.jiehuntong.adapter.Diy_ProgAdapter;
import a66weding.com.jiehuntong.adapter.MyProgressAdapter;
import a66weding.com.jiehuntong.application.DataWareHourse;
import a66weding.com.jiehuntong.base.BaseActivity;
import a66weding.com.jiehuntong.base.MyBaseFragmentActivity;
import a66weding.com.jiehuntong.beans.Diy_ProgressBean;
import a66weding.com.jiehuntong.beans.Diy_addprocessBean;
import a66weding.com.jiehuntong.beans.ErrorBean;
import a66weding.com.jiehuntong.beans.HttpRequestBean;
import a66weding.com.jiehuntong.beans.SuccessBean;
import a66weding.com.jiehuntong.beans.User;
import a66weding.com.jiehuntong.http.HttpHandleUtil;
import a66weding.com.jiehuntong.http.OnNetResultListener;
import a66weding.com.jiehuntong.http.RequestCode;
import a66weding.com.jiehuntong.http.UrlDealUtil;
import a66weding.com.jiehuntong.pager.BasePager;
import a66weding.com.jiehuntong.pager.Diy_findFriendPager;
import a66weding.com.jiehuntong.widgets.DividerItemDecoration;

/**
 * Created by admin on 2016/6/16.
 * 任务;
 */
public class Diy_ProgressActivity extends MyBaseFragmentActivity implements View.OnClickListener, OnNetResultListener {
    //返回键
    private RelativeLayout helpfrieds_back;
    private XRefreshView xRefreshView;
    private MyProgressAdapter diy_progAdapter;
    private RecyclerView recyclerView;
    @Override
    protected void initView() {
        create(R.layout.activity_diy_progress);
        helpfrieds_back = (RelativeLayout) findViewById(R.id.helpfrieds_back);
        helpfrieds_back.setOnClickListener(this);
        initRefreshView();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case  R.id. helpfrieds_back:
                this.finish();
                break;
        }
    }

    @Override
    public void onSucess(SuccessBean sucessbean) {

    }

    @Override
    public void onError(ErrorBean errorBean) {

    }
    //初始化上啦刷新
    private void initRefreshView() {
        xRefreshView = (XRefreshView)findViewById(R.id.xrefreshview);
        //是否允许下拉刷新
        xRefreshView.setPullRefreshEnable(true);
        // 设置是否可以上拉加载
        xRefreshView.setPullLoadEnable(true);
        // 设置刷新完成以后，headerview固定的时间
        xRefreshView.setPinnedTime(1000);
        // 静默加载模式不能设置footerview
        // 设置支持自动刷新
        xRefreshView.setAutoLoadMore(true);

        recyclerView = (RecyclerView)findViewById(R.id.recycler_view_test_rv);
        recyclerView.setHasFixedSize(true);
        //线性布局

        recyclerView.setLayoutManager(new LinearLayoutManager(this));

        diy_progAdapter = new MyProgressAdapter(this);
        recyclerView.setAdapter(diy_progAdapter);
        recyclerView.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.VERTICAL_LIST) );
        xRefreshView.setXRefreshViewListener(new XRefreshView.SimpleXRefreshListener() {

            @Override
            public void onRefresh() {
            }

            @Override
            public void onLoadMore(boolean isSlience) {
            }
        });
    }

}
